package com.sqb.ejb.ejb2;

import javax.ejb.Remote;
import javax.ejb.Stateless;

/**
 * @Stateless(name="testService", mappedName="ejb/ServiceBean")
 * default name is MyServiceBean, 
 * and the global jndi is ejb/ServiceBean which we set the mappedName
 * if we did't set the jndiName(mappedName)
 * the default globel Jndi is below
 * Portable JNDI names for EJB MyServiceBean :[java:global/ejb2/MyServiceBean!com.sqb.ejb.ejb2.MyService, java:global/ejb2/MyServiceBean]
 * (Non-portable) JNDI names for EJB MyServiceBean : [com.sqb.ejb.ejb2.MyService, com.sqb.ejb.ejb2.MyService#com.sqb.ejb.ejb2.MyService]
 * 
 * and we also can edit the description sun-ejb-jar.jar --this is used for sun service description
 * 
 * 	<enterprise-beans>
 *		<ejb>
 *			<ejb-name>MyServiceBean</ejb-name>
 *			<jndi-name>ejb/ServiceBeanJndi</jndi-name>
 *		</ejb>
 *	</enterprise-beans>
 *  if we use the description sun-ejb-jar, it will @Override the annotation managerBeans
 *  
 *  so when call the ejb, client call the ejb like below:
 *  	InitialContext context = new InitialContext();
 *		MyService ejb = (MyService)context.lookup("ejb/ServiceBeanJndi");
 *  so when call this ejb below whiel the sun-ejb-jar.xml is descriptioned 
 *  it will throws an exception can not find the jndiName ejb/ServiceBean
 *  	InitialContext context = new InitialContext();
 *		MyService ejb = (MyService)context.lookup("ejb/ServiceBean");
 *
 *  and we must know the default name is MyServiceBean while we never Override
 *  @Stateless(name="MyServiceBean", mappedName="ejb/ServiceBean")
 *  
 */
@Remote
@Stateless(mappedName="ejb/ServiceBean" )
public class MyServiceBean implements MyService {

	@Override
	public String getService(String user) {
		return "It is " + user +" service";
	}

}
